﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//简单子弹，以目标的 forward 轴为标准朝向移动 的子弹
[AddComponentMenu("Behavior/Bullet")]
public class BhvBullet : MonoBehaviour
{
    // Start is called before the first frame update
    // [Header("===== 自定义角度 =====")]
    // public bool isCustomForward = true;
    // public Vector3 bulletAngle;
    
    [Header("===== 子弹配置 =====")]
    public float speed = 1;
    public float acceleration =1;
    public float gravity = 9.8f;
    
    private void Update() {
        var dt= Time.deltaTime;
        speed += acceleration*dt;
        Vector3 forward =  transform.forward;  //isCustomForward?bulletAngle.normalized:transform.forward;
        transform.position += forward * dt * speed;
        transform.position -= new Vector3(0,gravity * dt,0);

        // if(isCustomForward){
        //     transform.rotation = Quaternion.Euler(bulletAngle);
        // }


    }
}
